<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Person List</title>
    </head>
    <body>
        <div class="body">
            <h1>志工列表</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                   	        <g:sortableColumn property="name" title="姓名" />
                   	        <g:sortableColumn property="uid" title="字號" />
                   	        <g:sortableColumn property="category" title="分類" />
                   	        <g:sortableColumn property="sport" title="運動項目" />
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${personInstanceList}" status="i" var="personInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                            <td><g:link action="show" id="${personInstance.id}">${fieldValue(bean:personInstance, field:'name')}</g:link></td>
                            <td>${fieldValue(bean:personInstance, field:'uid')}</td>
                            <td>
                           		<g:each in="${personInstance.categoryTags?}">
                           			${it.category.name}
                           		</g:each>
                            </td>
                            <td>
                            	<ul>
                            		<g:each in="${personInstance.sportTags?}">
                            			${it.sport.name}
                            		</g:each>
                            	</ul>
                            </td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${personInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
